package org.acghub.config;

import org.acghub.config.reader.*;

/**
 * @Desc
 * @Author miyuki4j
 * @Date 2025/7/24/星期四 11:21
 * @Version 1.0
 */
public enum TableReaderEnum {
    XLSX("xlsx", new XlsxTableReader()),

    CSV("csv", new CsvTableReader()),

    XLS("xls", new XlsTableReader()),

    ;

    private final String type;
    private final TableReader reader;

    TableReaderEnum(String type, TableReader reader) {
        this.type = type;
        this.reader = reader;
    }

    public static TableReaderEnum of(String type) {
        for (TableReaderEnum value : values()) {
            if (value.getType().equalsIgnoreCase(type)) {
                return value;
            }
        }
        return null;
    }

    public String getType() {
        return type;
    }

    public TableReader getReader() {
        return reader;
    }
}
